import { useChatStore } from '@/store/chat';

export function createAssistantAPI() {
    const chatStore = useChatStore();

    return {
        get sessionId() { return { value: chatStore.connectionState.assistantSessionId } },
        get connected() { return { value: chatStore.connectionState.isAssistantConnected } },
        get message() { return { value: chatStore.connectionState.assistantMessage } },
        get loading() { return { value: chatStore.connectionState.assistantLoading } },
        get error() { return { value: chatStore.connectionState.error } },

        sendMessage: (sessionId: string, message: string) => chatStore.sendAssistantMessage(sessionId, message),
        close: () => { },
        clearMessage: () => chatStore.clearAssistantMessage(),
        generateSessionId: () => chatStore.generateSessionId(),
        stopStream: () => chatStore.stopStream('assistant')
    };
}

